package com.sunbo509.www.gridview;

import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.widget.Button;

import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntroFragment;
import com.sunbo509.www.gridview.fragment.firstFragment;
import com.sunbo509.www.gridview.fragment.secondFragment;
import com.sunbo509.www.gridview.fragment.thirdFragment;

//引导页
public class DirectionActivity extends AppIntro {

    private Fragment fisrtfragment=new firstFragment();
    private Fragment secondfragment=new secondFragment();
    private Fragment thirdfragment=new thirdFragment();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


//自定义引导页
        addSlide(fisrtfragment);
        addSlide(secondfragment);
        addSlide(thirdfragment);
//默认引导页
//        addSlide(AppIntroFragment.newInstance("Android1","宋体",
//                "the fitst use this AppIntro", "黑体",
//                R.mipmap.ic_launcher_round,
//                Resources.getSystem().getColor(android.R.color.white),
//                Resources.getSystem().getColor(android.R.color.black),
//                Resources.getSystem().getColor(android.R.color.holo_blue_light)
//               ));
//        addSlide(AppIntroFragment.newInstance("Android2","宋体",
//                "the second use this AppIntro", "黑体",
//                R.mipmap.ic_launcher_round,
//                Resources.getSystem().getColor(android.R.color.black),
//                Resources.getSystem().getColor(android.R.color.white),
//                Resources.getSystem().getColor(android.R.color.holo_blue_light)
//        ));
//        addSlide(AppIntroFragment.newInstance("Android3","宋体",
//                "the third use this AppIntro", "黑体",
//                R.mipmap.ic_launcher_round,
//                Resources.getSystem().getColor(android.R.color.holo_green_dark),
//                Resources.getSystem().getColor(android.R.color.holo_red_dark),
//                Resources.getSystem().getColor(android.R.color.holo_blue_light)
//        ));



        setBarColor(Color.parseColor("#000000"));//底部栏
        showSkipButton(true);
        setSkipText("跳过");
        setProgressButtonEnabled(true);


//页面滚动之间的动画效果
//        setFadeAnimation();
//        setZoomAnimation();
//        setDepthAnimation();
//        setSlideOverAnimation();//覆盖切换

    }



    //当中间按钮点击做某事
        @Override
        public void onSkipPressed(Fragment currentFragment) {
            super.onSkipPressed(currentFragment);
            Intent intent=new Intent(this,MainActivity.class);
            startActivity(intent);
            setVibrate(true);
            setVibrateIntensity(300);
        }

//当最后按钮点击做某事
    @Override
    public void onDonePressed(Fragment currentFragment) {
        super.onDonePressed(currentFragment);
        Intent intent=new Intent(this,MainActivity.class);
        startActivity(intent);
    }
//当fragment切换做某事
    @Override
    public void onSlideChanged(@Nullable Fragment oldFragment, @Nullable Fragment newFragment) {
        super.onSlideChanged(oldFragment, newFragment);
        setFlowAnimation(); //立体切换动画
    }
}
